import App from './App'

import {
	createSSRApp
} from 'vue';

import {
	createPinia
} from 'pinia';
import {
	useStore
} from '@/store';

export function createApp() {

	const app = createSSRApp(App);

	const pinia = createPinia();
	app.use(pinia);
	app.config.globalProperties.store = useStore();

	const utils = {};
	for (let [key, value] of Object.entries(import.meta.glob('./utils/**/index.js', {
			eager: true
		}))) {
		utils[key.split("/")[2]] = value.default;
	}
	app.config.globalProperties.utils = utils;

	return {
		app
	}

}